package de.haw.halloWorld;

import android.annotation.SuppressLint;
import android.app.ListFragment;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

@SuppressLint("NewApi")
public class BasicListFragment extends ListFragment {
	
	public final String messageData[] = {"Hi", "Hallo Tom", "When will we meet?"};
	
	@Override
	public void onCreate(Bundle savedInstanceState) {	
		super.onCreate(savedInstanceState);
		
		ArrayAdapter<String> adapter = 
				new ArrayAdapter<String>(getActivity(),
						android.R.layout.simple_list_item_1, 
						messageData);
		setListAdapter(adapter);
	}
	
	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		Toast.makeText(getActivity(), "Klicked: " + position, Toast.LENGTH_SHORT).show();
	}
}
